package com.kinoshita.common.result;


import com.kinoshita.common.status.StatusCode;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


public class ResultDO<T> implements Serializable {

    private static final long serialVersionUID = 4661096805690919752L;

    private boolean success = true;

    private StatusCode StatusCode;

    private Map<String, T> models = new HashMap<>(4);

    /**
     * 创建一个result。
     */
    public ResultDO() {
    }

    /**
     * 创建一个result。
     *
     * @param success 是否成功
     */
    public ResultDO(boolean success) {
        this.success = success;
    }


    public boolean isSuccess() {
        return success;
    }


    public void setSuccess(boolean success) {
        this.success = success;
    }


    public Object getModel(String key) {
        return getModels().get(key);
    }


    public void setModel(String key, T model) {
        getModels().put(key, model);
    }


    public Map<String, T> getModels() {
        return models;
    }


    public StatusCode getStatusCode() {
        return StatusCode;
    }


    public void setStatusCode(StatusCode StatusCode) {
        this.StatusCode = StatusCode;
    }

}


